package com.wandian.setting.mvvm.messageset;

import android.os.Bundle;

import androidx.databinding.DataBindingUtil;

import com.alibaba.android.arouter.facade.annotation.Route;
import com.mylib.libcore.config.RouterConfig;
import com.mylib.libcore.mvvm.BaseMVVMActivity;
import com.mylib.libcore.utils.StatusBarUtils;
import com.wandian.setting.R;
import com.wandian.setting.databinding.SetActivityBindAccountBinding;
import com.wandian.setting.databinding.SetActivityMessageSetBinding;
import com.wandian.setting.databinding.SetActivitySettingBinding;

import java.util.ArrayList;
import java.util.List;

/**
 * @author Administrator
 * @date 2019/12/18-14:28
 * @description 系统消息设置
 **/
@Route(path = RouterConfig.ROUTER_ACTIVITY_SETTING_MESSAGE_SET)
public class MessageSetActivity extends  BaseMVVMActivity<MessageSetViewModel>  {
    private SetActivityMessageSetBinding dataBinding;
    private List<Boolean> messageManangeList = new ArrayList<>();
    @Override
    public void init(Bundle savedInstanceState) {
        dataBinding = DataBindingUtil.setContentView(this, R.layout.set_activity_message_set);
        dataBinding.setLifecycleOwner(this);
        dataBinding.setViewModel(mViewModel);
        initViewData();
        initClink();
    }
    private void initViewData(){
        //设置状态颜色和字体黑色
        StatusBarUtils.with(this,false)
                .setIsActionBar(false)
                .clearActionBarShadow()
                .setDrawable(getResources().getDrawable(com.mylib.libcore.R.drawable.sys_color))
                .init();
        dataBinding.bindSysToolBar.toolBarTvTitle.setText("系统设置");

        for(int i=0;i<6;i++){
            messageManangeList.add(false);
        }
        //接收消息通知
        dataBinding.bindItemIvRightBtn1.tvLeft.setText("接收消息通知");
        dataBinding.bindItemIvRightBtn1.ivBtn.setOnClickListener(v -> {
            messageManangeList.set(0,!messageManangeList.get(0));
            if(messageManangeList.get(0)){
                dataBinding.bindItemIvRightBtn1.ivBtn.setImageResource(R.drawable.toggle_on);
            }else {
                dataBinding.bindItemIvRightBtn1.ivBtn.setImageResource(R.drawable.toggle_off);
            }
        });



        //@我提醒
        dataBinding.bindItemIvRightBtn3.tvLeft.setText("@我提醒");
        dataBinding.bindItemIvRightBtn3.ivBtn.setOnClickListener(v -> {
            messageManangeList.set(2,!messageManangeList.get(2));
            if(messageManangeList.get(2)){
                dataBinding.bindItemIvRightBtn3.ivBtn.setImageResource(R.drawable.toggle_on);
            }else {
                dataBinding.bindItemIvRightBtn3.ivBtn.setImageResource(R.drawable.toggle_off);
            }
        });



        //签到提醒
        dataBinding.bindItemIvRightBtn6.tvLeft.setText("签到提醒");
        dataBinding.bindItemIvRightBtn6.ivBtn.setOnClickListener(v -> {
            messageManangeList.set(5,!messageManangeList.get(5));
            if(messageManangeList.get(5)){
                dataBinding.bindItemIvRightBtn6.ivBtn.setImageResource(R.drawable.toggle_on);
            }else {
                dataBinding.bindItemIvRightBtn6.ivBtn.setImageResource(R.drawable.toggle_off);
            }
        });



    }
    private void initClink(){
        dataBinding.bindSysToolBar.toolBarIvBack.setOnClickListener(v -> {
            finishhideSoftBoard();
            finish();
        });

    }


}
